Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update round_step_size to use quantize #1505

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pcriadoperez
Copy link
Collaborator

@pcriadoperez pcriadoperez commented Dec 9, 2024

Ran tests with old code and new code and gave the same result.
There was one exception where old code if step size was 1.0 would round like a step size of 1 while current implementations step size 1.0 rounds like 0.1

Fix #1496

@coveralls
Copy link

Coverage Status

coverage: 67.986%. remained the same
when pulling 2e27c2a on pcriadoperez:round-step-size
into 10f3986 on sammchardy:master.

@christophlins
Copy link

Please note that accepting float might lead to undesired results:

round_step_size(0.09999999999999999, 0.1)
Out[11]: 0.0

round_step_size(0.09999999999999999999, 0.1)
Out[12]: 0.1

If the type of the argument is float, add an eps (machine precision) prior to rounding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

round_step_size
4 participants